home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / suck-2.6 / suck-2 / suck-2.6.3 / sample / get.news.rnews < prev    next >
Text File  |  1996-03-29  |  2KB  |  82 lines

  1. #!/bin/sh
  2.  
  3. #NOTE: this script probably needs to be run by root.  Most systems will
  4. # not let a normal user run rnews
  5.  
  6. #BEFORE USING - check to ensure all the paths defined below are correct!!
  7.  
  8. REMOTE_HOST=news.pixi.com
  9. LOCAL_HOST=localhost
  10.  
  11. SPOOLDIR=/usr/spool/news        # base directory for articles to be rposted
  12. NEWSDIR=/usr/lib/news            # base directory for news binaries 
  13. BINDIR=/home/boby/doNews        # base directory for suck rpost and scripts
  14.  
  15. TMPDIR=${BINDIR}            # location for suck.* files
  16. DATADIR=${BINDIR}            # location of sucknewsrc and killfile
  17. MSGDIR=${BINDIR}/Msgs            # where to put MultiFile articles when getting them
  18.  
  19. BATCHFILE=${TMPDIR}/batch        # Name of batchfile to build for rnews or innxmit
  20. OUTGOING=${SPOOLDIR}/out.going/pixi    # location of the list of articles to upload
  21. SCRIPT=${BINDIR}/put.news        # my filter for rpost
  22. OUTFILE=/tmp/tmp$$            # used by rpost as article after it is filtered
  23.  
  24. RPOST=${BINDIR}/rpost            # my rpost
  25. SUCK=${BINDIR}/suck            # my suck
  26. TESTHOST=${BINDIR}/testhost        # my testhost
  27. RNEWS=${NEWSDIR}/rnews            # location of rnews
  28.  
  29.  
  30. # is the local host up and running so we can post articles we download?
  31. ${TESTHOST} ${LOCAL_HOST} > /dev/null 2>&1
  32. LOCAL_RESULT=$?
  33.  
  34. # is the remote host up and running so we can download articles?
  35. ${TESTHOST} ${REMOTE_HOST} > /dev/null 2>&1
  36. REMOTE_RESULT=$?
  37.  
  38. if [ ${REMOTE_RESULT} -eq 0 -a ${LOCAL_RESULT} -eq 0 ]; then
  39.  
  40.     # download articles
  41.     #if using rnews change the -bi to -br
  42.     ${SUCK} ${REMOTE_HOST} -br ${BATCHFILE} -dt ${TMPDIR} -dm ${MSGDIR} -dd ${DATADIR}
  43.     SUCK_STATUS=$?
  44.  
  45.     if [ ${SUCK_STATUS} -eq 0 ]; then
  46.         echo "Downloaded Articles"
  47.         mv ${DATADIR}/sucknewsrc ${DATADIR}/old.newsrc
  48.         mv ${TMPDIR}/suck.newrc ${DATADIR}/sucknewsrc
  49.         rm ${TMPDIR}/suck.*
  50.         if [ -f ${DATADIR}/suckothermsgs ]; then
  51.             rm ${DATADIR}/suckothermsgs
  52.         fi
  53.     fi
  54.  
  55.     # now upload articles
  56.     if [ -s ${OUTGOING} ]; then
  57.         # outgoing articles to post
  58.         ${RPOST} ${REMOTE_HOST} -b ${OUTGOING} -p ${SPOOLDIR} -f \$\$o=${OUTFILE} ${SCRIPT} \$\$i ${OUTFILE}
  59.  
  60.         if [ $? -ne 0 ]; then
  61.             echo "Error remote posting"
  62.             exit -1;
  63.         else
  64.             echo "Remotely posted articles"
  65.             rm ${OUTFILE} ${OUTGOING}
  66.         fi
  67.     fi    
  68.     
  69.     echo "You can hang up the modem now"
  70.  
  71.     if [ ${SUCK_STATUS} -eq 0 ]; then    
  72.         # locally post articles
  73.         ${RNEWS} ${LOCAL_HOST} < ${BATCHFILE}
  74.         
  75.         if [ $? -eq 0 ]; then
  76.             echo "Posted Articles Locally"
  77.             rm -rf ${MSGDIR}
  78.             rm ${BATCHFILE}
  79.         fi    
  80.     fi    
  81. fi
  82.